const BaseAdminController = require('./base_admin_controller.js');
const AdminMgrService = require('../../service/admin/admin_mgr_service.js');

class AdminMgrController extends BaseAdminController {
    // 管理员登录
    async login() {

        // 数据校验
        let rules = {
            name: 'must|string|min:5|max:30|name=管理员名',
            pwd: 'must|string|min:5|max:30|name=密码',
        };
        // 取得数据
        let input = this.validateData(rules);

        let service = new AdminMgrService();
        return await service.adminLogin(input.name, input.pwd);
    }

}

module.exports = AdminMgrController;